package com.ve.s2g

import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.produce
import kotlinx.coroutines.runBlocking

fun main(args: Array<String>) {
    runBlocking {
        var list = arrayListOf<ReceiveChannel<Int>>()
        for(i in 1..10) list.add(produce {
            send(i)
            close()
        })

        while(list.size!=10){

        }

        list.forEach{
            println(it.receive())
        }

    }
}